{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Moltres problems\n",
    "\n",
    "## Note that some problems with analytic solutions may also (or exclusively) be discussed in the `solve_1d_advection_diffusion_equation_notebook`."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## scalar-advection.i (<i>successful convergence to steady state</i>)\n",
    "\n",
    "This problem solves the 1D advection equation with a constant source, e.g. it solves the differential equation:\n",
    "\n",
    "\\begin{equation}\n",
    "\\frac{du}{dx} = 1\n",
    "\\end{equation}\n",
    "\n",
    "Basis functions are CONSTANT MONOMIALs. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1d_dg_advection_diffusion (<i>successful convergence to steady state</i>)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Solves:\n",
    "\n",
    "\\begin{equation}\n",
    "\\frac{\\partial u}{\\partial t} - \\frac{\\partial^2 u}{\\partial x^2} + \\frac{\\partial u}{\\partial x} = 1\n",
    "\\end{equation}\n",
    "\n",
    "with boundary conditions:\n",
    "\\begin{equation}\n",
    "u(0) = 0 \\\\\n",
    "u(1) = 1\n",
    "\\end{equation}\n",
    "\n",
    "Changing the `nl_rel_tol` from 1e-6 to 1e-2 changes the number of time steps to get to 1 second from over 5000 to 781. Problem did not reach steady state by one second, however it did by two seconds. Note that this problem formulation shows undershoots during the initial time steps on the right side of the domain, most likely because we are starting from an initial condition of u(x, 0) = 0 but with a Dirichlet boundary condition of u(1, t) = 1 at the RHS boundary. Perhaps with rDG(P0P1) we would not observe these oscillations; however with DG(P1) (what we are using here), we most certainly do."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1d_dg_advection_diffusion_outlet_neumann\n",
    "\n",
    "Solves:\n",
    "\n",
    "\\begin{equation}\n",
    "\\frac{\\partial u}{\\partial t} - \\frac{\\partial^2 u}{\\partial x^2} + \\frac{\\partial u}{\\partial x} = 1\n",
    "\\end{equation}\n",
    "\n",
    "with boundary conditions:\n",
    "\\begin{equation}\n",
    "u(0) = 0 \\\\\n",
    "\\frac{\\partial u}{\\partial x}\\Bigr|_{x=1} = 0\n",
    "\\end{equation}\n",
    "\n",
    "The analytic solution to the corresponding steady-state equation is:\n",
    "\n",
    "\\begin{equation}\n",
    "u(x) = -(e - 1)*e^{-1} + x - e^{x - 1} + 1\\\\\n",
    "\\frac{du}{dx} = -e^{x - 1} + 1\\\\\n",
    "\\frac{d^2u}{dx^2} = -e^{x-1}\\\\\n",
    "- \\frac{\\partial^2 u}{\\partial x^2} + \\frac{\\partial u}{\\partial x} = e^{x-1} - e^{x-1} + 1 = 1\n",
    "\\end{equation}\n",
    "\n",
    "Upon simplification:\n",
    "\n",
    "\\begin{equation}\n",
    "u(x) = x + e^{-1} - e^{x - 1}\n",
    "\\end{equation}\n",
    "\n",
    "as determined by sage math in the local notebook `solve_1d_advection_diffusion_equation`. By inspection, it's clear that the governing equation is satisfied as well as the boundary conditions. So we have a clear, correct analytic solution that we need to try and reproduce with our numerical methods in MOOSE. So far, the numerical solution is tending towards u(x) = x, which is wrong. So the question is to figure out why. Alright now we get a perfect result with DG! And we can run in Steady mode even with the FDP preconditioner. Something is clearly wrong with the user provided Jacobians. That's a debugging issue for tomorrow.\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1d_cg_advection_diffusion_outlet_neumann\n",
    "\n",
    "Solves:\n",
    "\n",
    "\\begin{equation}\n",
    "\\frac{\\partial u}{\\partial t} - \\frac{\\partial^2 u}{\\partial x^2} + \\frac{\\partial u}{\\partial x} = 1\n",
    "\\end{equation}\n",
    "\n",
    "with boundary conditions:\n",
    "\\begin{equation}\n",
    "u(0) = 0 \\\\\n",
    "\\frac{\\partial u}{\\partial x}\\Bigr|_{x=1} = 0\n",
    "\\end{equation}\n",
    "\n",
    "The analytic solution to the corresponding steady-state equation is:\n",
    "\n",
    "\\begin{equation}\n",
    "u(x) = -(e - 1)*e^{-1} + x - e^{x - 1} + 1\\\\\n",
    "\\frac{du}{dx} = -e^{x - 1} + 1\\\\\n",
    "\\frac{d^2u}{dx^2} = -e^{x-1}\\\\\n",
    "- \\frac{\\partial^2 u}{\\partial x^2} + \\frac{\\partial u}{\\partial x} = e^{x-1} - e^{x-1} + 1 = 1\n",
    "\\end{equation}\n",
    "\n",
    "Upon simplification:\n",
    "\n",
    "\\begin{equation}\n",
    "u(x) = x + e^{-1} - e^{x - 1}\n",
    "\\end{equation}\n",
    "\n",
    "as determined by sage math in the local notebook `solve_1d_advection_diffusion_equation`. By inspection, it's clear that the governing equation is satisfied as well as the boundary conditions. So we have a clear, correct analytic solution that we need to try and reproduce with our numerical methods in MOOSE. So far, the numerical solution is tending towards u(x) = x, which is wrong, **just like for the above dg case**. Given that, it seems likely that the issue in terms of accuracy is not the dg formulation. I'm tending to believe it must be the right boundary condition because recall that u(x) = x is a possible solution to the second order ODE pending boundary conditions. And the LHS BC is holding true. It's the RHS BC that is being violated. So...the issue was that I had changed my diffusion coefficient to .1, so actually the solve was perfect for CG! Now with diffusion coefficient changed to 1, I am getting the exactly correct analytical solution as predicted by `Sage`.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/al007/miniconda3/lib/python3.5/site-packages/matplotlib/font_manager.py:280: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.\n",
      "  'Matplotlib is building the font cache using fc-list. '\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "data = np.loadtxt(\"residual_data.txt\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[  0.00000000e+00,   3.00487600e-02],\n",
       "       [  1.00000000e+00,   4.06049400e-03],\n",
       "       [  2.00000000e+00,   1.50606600e-03],\n",
       "       [  3.00000000e+00,   4.18862200e-04],\n",
       "       [  4.00000000e+00,   2.30923300e-04],\n",
       "       [  5.00000000e+00,   9.61072900e-05],\n",
       "       [  6.00000000e+00,   5.53597700e-05],\n",
       "       [  7.00000000e+00,   2.77124500e-05],\n",
       "       [  8.00000000e+00,   1.58282800e-05],\n",
       "       [  9.00000000e+00,   8.56284800e-06],\n",
       "       [  1.00000000e+01,   4.88907200e-06],\n",
       "       [  1.10000000e+01,   2.73969200e-06],\n",
       "       [  1.20000000e+01,   1.57062700e-06],\n",
       "       [  1.30000000e+01,   8.95200600e-07],\n",
       "       [  1.40000000e+01,   5.15306700e-07],\n",
       "       [  1.50000000e+01,   2.96176600e-07],\n",
       "       [  1.60000000e+01,   1.70979100e-07],\n",
       "       [  1.70000000e+01,   9.86809500e-08],\n",
       "       [  1.80000000e+01,   5.70670200e-08],\n",
       "       [  1.90000000e+01,   3.30044800e-08],\n",
       "       [  2.00000000e+01,   1.91053900e-08]])"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl8VPW9//HXJxth33cIS8LigiCETYEQUHCpIlpERUXt\nFQQUreJW77Xt/fXWa61gi/taa1vrjlRRyr4IAmGVNYQ9YUvY9y3f3x8z3KYxCYHJzJnMvJ+PRx7M\nzDlzvh/PHN85+c73fI855xARkcgX43UBIiISGgp8EZEoocAXEYkSCnwRkSihwBcRiRIKfBGRKKHA\nFxGJEgp8EZEoocAXEYkScV4XUFCdOnVc8+bNvS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L6bzRTm6f4CbqP4/wm92F9n1XfO7fA/3gnUL2Idr/fdffj+OivKuT73YHjI/3m9W0wXhZf7\nqyewyzm3vpjlQd9fhbLBk+OrvAV+WDOzKsBnwCPOucL38F0CJDnnLgPGAxNCVFYP51wH4FpglJn1\nClG752RmCcCNwCdFLPZqf/2I8/19HVbD2czsGeA08NdiVgn15/4avq6HDvhubfpikNs7X7dT8tl9\nUPdXSdmZZemUAAAB70lEQVQQyuOrvAV+DtC0wPMm/tfOd50yZ2bx+D7QvzrnPi+83Dl30PmmjcY5\nNwmIN7M6wa7LOZfj/3c3vqmsuxRaxZP95XctsMQ5t6vwAq/2VwG7znZt+f/dXcQ6Xh1r9wA/AYb4\nw+JHSvG5lynn3C7n3BnnXD7wVjHtebW/4oCbgY+KWyeY+6uYbPDk+Cpvgb8IaGVmLfxnh7cBEwut\nMxG42z/6pBtwoMCfTkHh7x98B1jjnBtbzDoN/OthZl3w7fs9Qa6rsplVPfsY3xd+KwutFvL9VUCx\nZ11e7K9CJgJD/Y+HAkXdv7k0x2OZMrNrgCeAG51zR4tZpzSfe1nXVfB7n4HFtBfy/eV3FbDWOZdd\n1MJg7q8SssGb46usv5UO9g++USWZ+L69fsb/2gPAA/7Hhu+OWxuAH4DUENTUA9+fZCuAZf6f6wrV\n9SCwCt837d8DV4Sgrpb+9pb72w6L/eVvtzK+AK9e4DVP9he+Xzo7gFP4+kl/BtQGpgHrgalALf+6\njYBJJR2PQa4rC1+/7tnj7PXCdRX3uQe5rg/8x88KfKHUMBz2l//1P509rgqsG5L9VUI2eHJ86Upb\nEZEoUd66dERE5AIp8EVEooQCX0QkSijwRUSihAJfRCRKKPBFRKKEAl9EJEoo8EVEosT/B0/ft6XP\nlaB/AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f28f5ada588>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "iteration_num = data[:,0]\n",
    "residuals = np.log(data[:,1])\n",
    "plt.plot(iteration_num, residuals)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## edge4\n",
    "\n",
    "This problem was built to test whether libMesh supported EDGE4 elements for third order LAGRANGE and L2_LAGRANGE polynomials. The answer is no. However, libMesh does support EDGE3 elements for second order LAGRANGE and L2_LAGRANGE polys. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2d_advection_diffusion_mimic_msr\n",
    "\n",
    "This is a 2D test case mean to mimic the convection-diffusion properties of the MSR model. There is a fuel region with advection and a source and then there is a moderator region with only diffusion. Boundary conditions are Dirichlet at the bottom foundary (both fuel and moderator) and then an outflow condition at the fuel top. Everywhere else is insulated. Results look good. Able to achieve steady-state for velocity ranging from 1e-3 to 1e3 while diffusion coefficient and source coefficient stay constant at 1. However, there is a negative value somewhere in the domain, which should not be the case. Ok the negative values were on the graphite_bottom portion of the domain. Negative values were observed for monomial basis functions with sigma = 6 and 60. However, with l2_lagrange, negative values were not observed for sigma = 60 or 6. Hmm, might be time to try that tomorrow with the actual MSR temperature simulation..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
